#include <cmath>
#include <cstdio>
using namespace std;
//TODO:...

int n, m;

int main() {
#ifndef ONLINE_JUDGE
#ifdef DEBUG
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
#endif
#ifndef DEBUG
	freopen("egg.in", "r", stdin);
	freopen("egg.out", "w", stdout);
#endif
#endif
	scanf("%d%d", &n, &m);
	if (m == 1)
		printf("%d", n);
	else {
		printf("%d", (int)(sqrt(n) + (int)sqrt(sqrt(n)) + 1));
	}
	return 0;
}